/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package comunicatorserver.irc;


import comunicatorserver.ComunicatorServer;
import java.applet.AudioClip;
import java.net.URL;
import org.schwering.irc.lib.IRCEventListener;
import org.schwering.irc.lib.IRCModeParser;
import org.schwering.irc.lib.IRCUser;


/**
 *
 * @author rjsantos
 */
public class MyIRCEventListener implements IRCEventListener{




     private ComunicatorServer comunicatorServer;


    /** Creates new form ComunicatorGUI */
    public MyIRCEventListener ( ComunicatorServer cServer) {

        comunicatorServer=cServer;

        //comunicatorServer = cServer;

    }

    public void onRegistered() {
        System.out.println("onRegistered");
    }

    public void onDisconnected() {
        System.out.println("onDisconnected");
    }

    public void onError(String arg0) {
        System.out.println("onError::" + arg0);
    }

    public void onError(int arg0, String arg1) {
        System.out.println("onError:" + arg0 + " " + arg1);
    }

    public void onInvite(String arg0, IRCUser arg1, String arg2) {
        System.out.println("onInvite");
    }

    public void onJoin(String arg0, IRCUser arg1) {
        System.out.println("onJoin");
        
    }

    public void onKick(String arg0, IRCUser arg1, String arg2, String arg3) {
        System.out.println("onKick");
    }

    public void onMode(String arg0, IRCUser arg1, IRCModeParser arg2) {
        System.out.println("onMode");
    }

    public void onMode(IRCUser arg0, String arg1, String arg2) {
        System.out.println("onMode");
    }

    public void onNick(IRCUser arg0, String arg1) {
        System.out.println("onNick");
    }

    public void onNotice(String arg0, IRCUser arg1, String arg2) {
        System.out.println("onNotice" + arg0 + arg2);
    }

    public void onPart(String arg0, IRCUser arg1, String arg2) {
        System.out.println("onPart");
    }

    public void onPing(String arg0) {
        System.out.println("onPing");
    }

    public void onPrivmsg(String arg0, IRCUser arg1, String arg2) {
        System.out.println("onPrivmsg" + arg0 + " " + arg1.getNick() + " " + arg2);
        //comunicatorGui.recieveMessage(arg1.getNick(), arg2);
        //cServer.

        if(arg2.compareTo("SendToque")==0){
            comunicatorServer.sendNotifications(arg1.getNick());
        }
    }

    public void onQuit(IRCUser arg0, String arg1) {
        System.out.println("onQuit");
    }

    public void onReply(int arg0, String arg1, String arg2) {
        System.out.println( "onReply arg0 "+arg0+ " arg1 "+arg1+ " arg2 "+arg2);

        if( arg0==353){

            //comunicatorGui.setUsers(arg2);
        }
    }

    public void onTopic(String arg0, IRCUser arg1, String arg2) {
        System.out.println("onTopic arg0 "+arg0+ " arg2 "+arg2);
    }

    public void unknown(String arg0, String arg1, String arg2, String arg3) {
        System.out.println( "unknown arg0 "+ arg0 + " arg1 "+arg1+ " arg2 "+arg2+ " arg3 "+arg3);
    }


   
}
